import request from '@/utils/request'

export function getParamData(requestBody) {
  // /api/template/type/allList
  return request({
    url: '/template/param',
    method: 'post',
    data: requestBody,
  })
}

export function getSimpleList(type) {
  // console.log(type, 'type')
  // /api/template/type/allList
  return request({
    url: '/template/param/simpleList',
    method: 'post',
    data: { type },
  })
}

export function getRecorderList() {
  return request({
    url: '/template/recorder/list',
    method: 'get',
  })
}

export function updateRecorder(requestBody) {
  return request({
    url: '/template/recorder/update',
    method: 'post',
    data: requestBody,
  })
}

// export function getAllParamData() {
//   return request({
//     url: '/template/param/all',
//     method: 'get'
//   })
// }

export function addType(requestBody) {
  return request({
    url: '/template/param/add',
    method: 'post',
    data: requestBody,
  })
}

export function deleteType(requestBody) {
  return request({
    url: '/template/param/delete',
    method: 'post',
    data: requestBody,
  })
}

export function getAudio(audioName) {
  return request({
    url: '/audio/' + audioName,
    method: 'GET',
    responseType: 'blob',
  })
}

export function getVariables() {
  return request({
    url: '/template/variables/list',
    method: 'get',
  })
}

export function getRecorders() {
  return request({
    url: '/template/recorder/list',
    method: 'get',
  })
}

export function getCategory() {
  return request({
    url: '/template/category',
    method: 'get',
  })
}

export function getScene(category) {
  return request({
    url: '/template/category/scene?category=' + category,
    method: 'get',
  })
}

export function getTemplateNameList() {
  return request({
    url: '/template/getTemplateNameList',
    method: 'get',
  })
}

export function getTemplateFlowDiagram(id) {
  return request({
    url: '/template/getTemplateFlowDiagram?id=' + id,
    method: 'get',
  })
}
